﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="CrossFactoryTest.cs" company="pwasiewicz">
//   pwasiewicz
// </copyright>
// <summary>
//   Defines the CrossFactoryTest type.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace LogicSystem.Tests
{
    using LogicSystem.Exceptions;

    using Microsoft.VisualStudio.TestTools.UnitTesting;

    /// <summary>The cross factory test.</summary>
    [TestClass]
    public class CrossFactoryTest
    {
        /// <summary>
        /// Checking if adding cross factory elements throws exception.
        /// </summary>
        [TestMethod]
        [ExpectedException(typeof(LogicElementsFactoryDismatchException))]
        public void AddingElementsFromDifferentFactories()
        {
            var factory1 = new LogicElementsFactory();
            var factory2 = new LogicElementsFactory();

            var gate = factory1.CreateGateAnd();
            var wire = factory2.CreateWire();
            var wireOut = factory1.CreateWire();

            gate.AddInputWires(wire);
            gate.AddInputWires(wireOut);
            wire.AddOutputGates(gate);

            factory1.CreateLogicSystemSimulator(wireOut, wire).Simulate(true);
        }
    }
}
